<template>
  <el-form :inline="true" :model="formInline" class="demo-form-inline">
    <el-form-item label="公司名称">
      <el-input v-model="formInline.companyName" placeholder="请输入公司名称"></el-input>
    </el-form-item>
    <el-form-item label="选择查询时间段">
      <el-date-picker
        v-model="formInline.searchTime"
        type="daterange"
        range-separator="到"
        start-placeholder="开始日期"
        end-placeholder="结束日期"
      >
      </el-date-picker>
    </el-form-item>
    <el-form-item>
      <el-button type="primary" @click="onSubmit('formInline')">查询</el-button>
    </el-form-item>
  </el-form>
</template>
<script setup lang="ts">
  import { getCurrentInstance } from 'vue'
  defineProps(['formInline'])
  const internalInstance = getCurrentInstance()
  const emit = defineEmits({
    searchChange: null
  })
  const onSubmit = (formName: string) => {
    const { companyName, searchTime } = internalInstance?.proxy?.[formName]
    emit('searchChange', {
      companyName,
      searchTime
    })
  }
</script>
